package com.lejin.controller;

import com.lejin.dto.SearchDTO;
import com.lejin.entity.ESCourse;
import com.lejin.service.ISearchService;

import com.lejin.vo.PageResultVO;
import com.lejin.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("search")
public class SearchController {

    @Autowired
    private ISearchService searchService;


    @RequestMapping("init")
    public ResultVO init(){

        return searchService.init();
    }


    @RequestMapping("course")
    public PageResultVO<ESCourse> course(@RequestBody SearchDTO dto){
        PageResultVO<ESCourse> search = searchService.search(dto);
        return search;

    }


}
